home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 001-100 / 001-025 / 005 / mandelbrotsrc / mand.c < prev    next >
C/C++ Source or Header  |  1995-03-17  |  22KB  |  723 lines

  1.  
  2. /*
  3.                     MAND.C - Command parsing
  4.             Mandelbrot's Self-Squared Dragon Generator
  5.                     For the Commodore Amiga
  6.                          Version 2.01
  7.  
  8.          Inspired by Scientific American, August/1985
  9.  
  10.            Corrections and improvements suggested by
  11.                   The Fractal Geometry of Nature
  12.      By Benoit Mandelbrot, W.H. Freeman and Company, 1983
  13.           (Used to be Z=Z^2+C, now is Z=Z^2-u, etc.)
  14.  
  15.              Copyright (C) 1985, Robert S. French
  16.             Vastly Enhanced by =RJ Mical=  1985/86
  17.             Copyright (C) 1986,  =Robert J. Mical=
  18.                  Placed in the Public Domain
  19.  
  20.  
  21. This program may be distributed free of charge as long as the above
  22. notice is retained.
  23.  
  24. Please see the accompanying documentation for more information.
  25.  
  26. Send ANY problems or suggestions to the address in the <I>nformation
  27. section.  Thank you!
  28.  
  29. Programs should be compiled with:
  30.  
  31. 1> lc -i:include/ -i:include/lattice/ mand.c
  32. 1> lc -i:include/ -i:include/lattice/ mand1.c
  33. 1> lc -i:include/ -i:include/lattice/ mand2.c
  34. 1> lc -i:include/ -i:include/lattice/ mand3.c
  35. 1> lc -i:include/ -i:include/lattice/ mand4.c
  36. 1> lc -i:include/ -i:include/lattice/ mand5.c
  37. 1> lc -i:include/ -i:include/lattice/ mand6.c
  38. 1> alink :lib/Lstartup.obj+mand.o+mand1.o+mand2.o+mand3.o+mand4.o+mand5.o+mand6.o to Mandelbrot lib :lib/lc.lib+:lib/amiga.lib
  39.  
  40. */
  41.  
  42.  
  43. /* ===========================================================================
  44.    ===========================================================================
  45. From: "french robert%d.mfenet"@LLL-MFE.ARPA
  46.  
  47. By the way, on a historical note, the "Mandelbrot Set" as related in
  48. Scientific American is a little different from the u-Map implemented
  49. here (as discussed in Mandelbrot's "The Fractal Geometry of Nature").
  50. The main difference is the use of Z <- Z^2+C in Scientific American vs.
  51. Z <- Z^2-u in the book and this program.  The primary effect is the reversal
  52. of the picture across the Y axis.
  53.  
  54. Enjoy!
  55.  
  56.                  Robert French
  57.                  French#Robert%d@LLL-MFE.ARPA
  58.  
  59.    ========================================================================
  60.    ======================================================================== */
  61.  
  62.  
  63. #include "mand.h"
  64.  
  65.  
  66. int MathBase,MathTransBase;
  67.  
  68.  
  69. /*----------------------*/
  70. /* Graphics definitions */
  71.  
  72. struct   GfxBase       *GfxBase;
  73. struct   IntuitionBase *IntuitionBase;
  74. struct   IconBase      *IconBase;
  75.  
  76. SHORT Color0, Color1, Color2;
  77. SHORT UserPalette[29];
  78.  
  79.  
  80. /*----------------------------------*/
  81. /* Miscellaneous Global Definitions */
  82.  
  83. union kludge {
  84.    float f;
  85.    int i;
  86. } start_r,end_r,start_i,end_i;
  87. int max_x,max_y,max_mem_y;
  88. int max_count,color_inc,color_offset,color_set,color_mode,color_div;
  89. int color_inset,func_num;
  90.  
  91. int v_starty,max_mem;
  92. long v_offset;
  93. UWORD *color_table,*v_mand_store;
  94.  
  95. int modified,want_read;
  96.  
  97. FILE *console,*v_fp = NULL,*redir_fp = NULL;
  98.  
  99. SHORT ZoomCenterX, ZoomCenterY, ZoomBoxSizeX, ZoomBoxSizeY;
  100. SHORT ZoomBoxStartX, ZoomBoxStartY;
  101.  
  102. int cur_resource = NULL;
  103.  
  104.  
  105. /*-------------*/
  106. /* Here we go! */
  107.  
  108. main()
  109. {
  110.    FILE *fopen();
  111.    char *fgets(),*stpblk();
  112.    float cnvf();
  113.    void anal_mand(),wait_close();
  114.  
  115.    int temp, y, i;
  116.    char *cmd,inp_buf[80],secchar,*argpos;
  117.    union kludge scale;
  118.    FILE *fp;
  119.  
  120.    max_mem_y = MAXMY;
  121.  
  122.    color_table = (UWORD *)malloc(4096*sizeof(UWORD));
  123.    if (color_table == NULL)
  124.       abort("Can't allocate memory for color table");
  125.    cur_resource |= F_COLORTAB;
  126.  
  127.    v_mand_store = (UWORD *)malloc(MAXX*max_mem_y*sizeof(UWORD));
  128.    if (v_mand_store == NULL)
  129.       abort("Can't allocate memory for set storage");
  130.    cur_resource |= F_SETSTORE;
  131.  
  132.    MathBase = OpenLibrary("mathffp.library",0);
  133.    if (MathBase < 1)
  134.       abort("Can't open mathffp.library");
  135.    cur_resource |= F_MATH;
  136.  
  137.    MathTransBase = OpenLibrary("mathtrans.library",0);
  138.    if (MathTransBase < 1)
  139.       abort("Can't open mathtrans.library");
  140.    cur_resource |= F_MATHTRANS;
  141.  
  142.    GfxBase = (struct GfxBase *)OpenLibrary("graphics.library",0);
  143.    if (GfxBase == NULL)
  144.       abort("Can't open graphics.library");
  145.    cur_resource |= F_GRAPHICS;
  146.  
  147.    IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0);
  148.    if (IntuitionBase == NULL)
  149.       abort("Can't open intuition.library");
  150.    cur_resource |= F_INTUITION;
  151.  
  152.    IconBase = (struct IconBase *)OpenLibrary("icon.library",0);
  153.    if (IconBase == NULL)
  154.       abort("Can't open icon.library");
  155.    cur_resource |= F_ICON;
  156.  
  157.    console = fopen("con:0/0/640/200/Mandelbrot Commands","w+");
  158.    if (console == NULL)
  159.       abort("Can't open console window");
  160.    cur_resource |= F_CONSOLE;
  161.  
  162.    fprintf(console,
  163.       "Mandelbrot Self-Squared Dragon Generator - Version %s\n",VERSION);
  164.    fputs("Copyright (C) 1985, Robert S. French\n",console);
  165.    fputs(
  166.       "Vastly Enhanced (with Intuition!) by =RJ Mical=  1985/86\n",console);
  167.    fputs("Copyright (C) 1986, =Robert J. Mical=\n",console);
  168.    fputs("\n",console);
  169.    fputs(
  170.       "Placed in the public domain -- Read the source and learn!\n",console);
  171.    fputs("\n",console);
  172.    fputs("Type '?' or 'H' or <RETURN> for help\n\n",console);
  173.  
  174.    SetPresets(0);
  175.    Color0 = 0x22F;
  176.    Color1 = 0xFFF;
  177.    Color2 = 0x000;
  178.    for (i = 0; i <= 28; i++)
  179.       UserPalette[i] = ((i & 0xF) << 8) | ((i & 0xF) << 4) | ((i & 0xF) << 0);
  180.  
  181.    for (EVER) {
  182.  
  183. command:
  184.  
  185.       fprintf(console,"Command: ");
  186.       rewind(console);
  187.       if (redir_fp)
  188.          if (Chk_Abort()) {
  189.             fputs("\nRedirected input aborted!\n",console);
  190.             fclose(redir_fp);
  191.             redir_fp = NULL;
  192.          }
  193.          else {
  194.             cmd = fgets(inp_buf,78,redir_fp);
  195.             if (cmd == NULL) {
  196.                fputs("End of file encountered.\n",console);
  197.                fclose(redir_fp);
  198.                redir_fp = NULL;
  199.                cmd = fgets(inp_buf,40,console);
  200.             }
  201.             else
  202.                fputs(inp_buf,console);
  203.          }
  204.       else
  205.          cmd = fgets(inp_buf,40,console);
  206.       *(cmd+strlen(cmd)-1) = '\0';
  207.       secchar = toupper(*(cmd+1));
  208.       argpos = stpblk(cmd+2);
  209.       rewind(console);
  210.       switch (toupper(*cmd)) {
  211.          case 'I':
  212.             sscanf(argpos,"%d",&temp);
  213.         Information(temp);
  214.             goto command;
  215.          case 'S':
  216.             if (secchar == 'R') {
  217.                sscanf(argpos,"%f",&start_r.f);
  218.                start_r.i = SPFieee(start_r.i);
  219.                if (v_fp) {
  220.                   fclose(v_fp);
  221.                   v_fp = NULL;
  222.                }
  223.                goto command;
  224.             }
  225.             if (secchar == 'I') {
  226.                sscanf(argpos,"%f",&start_i.i);
  227.                start_i.i = SPFieee(start_i.i);
  228.                if (v_fp) {
  229.                   fclose(v_fp);
  230.                   v_fp = NULL;
  231.                }
  232.                goto command;
  233.             }
  234.             if (secchar == 'H') {
  235.                fputs("Current settings:\n",console);
  236.                CurrentSettings();
  237.                goto command;
  238.             }
  239.             if (secchar == 'A') {
  240.                fp = fopen(argpos,"w");
  241.                if (fp == NULL) {
  242.                   fprintf(console,"Cannot open file '%s'\n",argpos);
  243.                   goto command;
  244.                }
  245.                putc((char) 1,fp);
  246.                fwrite(&start_r,sizeof(start_r),1,fp);
  247.                fwrite(&start_i,sizeof(start_i),1,fp);
  248.                fwrite(&end_i,sizeof(end_i),1,fp);
  249.                fwrite(&max_x,sizeof(max_x),1,fp);
  250.                fwrite(&max_y,sizeof(max_y),1,fp);
  251.                want_read = TRUE;
  252.                for (y=0;y<max_y;y++) {
  253.                   v_pos_line(y);
  254.                   if(fwrite(v_mand_store+(y-v_starty)*max_x,
  255.                             max_x*sizeof(UWORD),1,fp) != 1) {
  256.                      fputs("Error while writing to file\n",console);
  257.                      break;
  258.                   }
  259.                }
  260.                fclose(fp);
  261.                goto command;
  262.             }
  263.             ill_cmd();
  264.             goto command;
  265.          case 'E':
  266.             if (secchar == 'R') {
  267.                sscanf(argpos,"%f",&end_r.i);
  268.                end_r.i = SPFieee(end_r.i);
  269.                if (v_fp) {
  270.                   fclose(v_fp);
  271.                   v_fp = NULL;
  272.                }
  273.                goto command;
  274.             }
  275.             if (secchar == 'I') {
  276.                sscanf(argpos,"%f",&end_i.i);
  277.                end_i.i = SPFieee(end_i.i);
  278.                if (v_fp) {
  279.                   fclose(v_fp);
  280.                   v_fp = NULL;
  281.                }
  282.                goto command;
  283.             }
  284.             ill_cmd();
  285.             goto command;
  286.          case 'M':
  287.             if (secchar == 'X') {
  288.                sscanf(argpos,"%d",&temp);
  289.                if (temp < 5 ||
  290.                      (temp > 320 && !(color_mode & 4)) ||
  291.                      (temp > 640 && (color_mode & 4))) {
  292.                   fputs("Illegal parameter!\n",console);
  293.                   goto command;
  294.                }
  295.                max_x = temp;
  296.                max_mem = max_mem_y * MAXX;
  297.                max_mem /= max_x;
  298.                if (v_fp) {
  299.                   fclose(v_fp);
  300.                   v_fp = NULL;
  301.                }
  302.                goto command;
  303.             }
  304.             if (secchar == 'Y') {
  305.                sscanf(argpos,"%d",&temp);
  306.                if (temp < 5 ||
  307.                      (temp > 200-STARTY && !(color_mode & 2)) ||
  308.                      (temp > 400-STARTY && (color_mode & 2))) {
  309.                   fputs("Illegal parameter!\n",console);
  310.                   goto command;
  311.                }
  312.                max_y = temp;
  313.                if (v_fp) {
  314.                   fclose(v_fp);
  315.                   v_fp = NULL;
  316.                }
  317.                goto command;
  318.             }
  319.             if (secchar == 'C') {
  320.                sscanf(argpos,"%d",&temp);
  321.                if (temp * color_inc + color_offset > 4095) {
  322.                   fputs("More than 4096 colors!\n",console);
  323.                   goto command;
  324.                }
  325.                if (temp < 2) {
  326.                   fputs("MaxCount must be greater than 1\n",console);
  327.                   goto command;
  328.                }
  329.                max_count = temp;
  330.                goto command;
  331.             }
  332.             if (secchar == 'M') {
  333.                sscanf(argpos,"%d",&temp);
  334.                if (temp < 5) {
  335.                   fputs("Number of lines must be >4!\n",console);
  336.                   goto command;
  337.                }
  338.                free(v_mand_store);
  339.                v_mand_store = (UWORD *)malloc(MAXX*temp*sizeof(UWORD));
  340.                if (v_mand_store == NULL) {
  341.                   fputs("Can't allocate that much memory for set storage",console);
  342.                   v_mand_store = (UWORD *)malloc(MAXX*max_mem_y*sizeof(UWORD));
  343.                   if (v_mand_store == NULL)
  344.                      abort("Can't reallocate memory!!!");
  345.                   goto command;
  346.                }
  347.                max_mem_y = temp;
  348.                if (v_fp) {
  349.                   fclose(v_fp);
  350.                   v_fp = NULL;
  351.                }
  352.                max_mem = MAXX * max_mem_y;
  353.                max_mem /= max_x;
  354.                goto command;
  355.             }
  356.             ill_cmd();
  357.             goto command;
  358.          case 'L':
  359.             if (v_fp) {
  360.                fclose(v_fp);
  361.                v_fp = NULL;
  362.             }
  363.             v_fp = fopen(stpblk(cmd+1),"r");
  364.             if (v_fp == NULL) {
  365.                fprintf(console,"Cannot open file '%s'\n",stpblk(cmd+1));
  366.                goto command;
  367.             }
  368.             if (getc(v_fp) != 1) {
  369.                fputs("File is not in proper format\n",console);
  370.                fclose(v_fp);
  371.                v_fp = NULL;
  372.                goto command;
  373.             }
  374.             fread(&start_r,sizeof(start_r),1,v_fp);
  375.             fread(&end_r,sizeof(end_r),1,v_fp);
  376.             fread(&start_i,sizeof(start_i),1,v_fp);
  377.             fread(&end_i,sizeof(end_i),1,v_fp);
  378.             fread(&max_x,sizeof(max_x),1,v_fp);
  379.             fread(&max_y,sizeof(max_y),1,v_fp);
  380.             v_offset = 25L;
  381.             modified = FALSE;
  382.             v_starty = max_mem+1;
  383.             want_read = TRUE;
  384.             v_pos_line(0);
  385.             goto command;
  386.          case 'X':
  387.             if (secchar == 'R') {
  388.                sscanf(argpos,"%f",&scale.f);
  389.                scale.i = SPFieee(scale.i);
  390.                start_r.i = SPAdd(start_r.i,scale.i);
  391.                end_r.i = SPAdd(end_r.i,scale.i);
  392.                if (v_fp) {
  393.                   fclose(v_fp);
  394.                   v_fp = NULL;
  395.                }
  396.                goto command;
  397.             }
  398.             if (secchar == 'I') {
  399.                sscanf(argpos,"%f",&scale.f);
  400.                scale.i = SPFieee(scale.i);
  401.                start_i.i = SPAdd(start_i.i,scale.i);
  402.                end_i.i = SPAdd(end_i.i,scale.i);
  403.                if (v_fp) {
  404.                   fclose(v_fp);
  405.                   v_fp = NULL;
  406.                }
  407.                goto command;
  408.             }
  409.             ill_cmd();
  410.             goto command;
  411.          case 'Z':
  412.             if (secchar != 'R' && secchar != 'I' && secchar != 'B') {
  413.                ill_cmd();
  414.                goto command;
  415.             }
  416.             if (v_fp) {
  417.                fclose(v_fp);
  418.                v_fp = NULL;
  419.             }
  420.             if (secchar != 'I' ) {
  421.                /* scale along the real axis */
  422.                sscanf(argpos,"%f",&scale.f);
  423.            ZoomAlongDarling(SPFieee(scale.i), SPFlt(1));
  424.             }
  425.             if (secchar != 'R') {
  426.                /* scale along the complex axis */
  427.                sscanf(argpos,"%f",&scale.f);
  428.            ZoomAlongDarling(SPFlt(1), SPFieee(scale.i));
  429.             }
  430.             goto command;
  431.          case 'C':
  432.             if (secchar == 'I') {
  433.                sscanf(argpos,"%d",&temp);
  434.                if (max_count * temp + color_offset > 4095) {
  435.                   fputs("More than 4096 colors!\n",console);
  436.                   goto command;
  437.                }
  438.                if (temp < 1) {
  439.                   fputs("Increment must be greater than 0!\n",console);
  440.                   goto command;
  441.                }
  442.                color_inc = temp;
  443.                goto command;
  444.             }
  445.             if (secchar == 'O') {
  446.                sscanf(argpos,"%d",&temp);
  447.                if (max_count * color_inc + temp > 4095) {
  448.                   fputs("More than 4096 colors!\n",console);
  449.                   goto command;
  450.                }
  451.                if (temp < 0) {
  452.                   fputs("Negative offset illegal!\n",console);
  453.                   goto command;
  454.                }
  455.                color_offset = temp;
  456.                goto command;
  457.             }
  458.             if (secchar == 'S') {
  459.                sscanf(argpos,"%d",&temp);
  460.                if (temp < 0 || temp > 2) {
  461.                   fputs("Illegal color set!\n",console);
  462.                   goto command;
  463.                }
  464.                color_set = temp;
  465.                init_colors();
  466.                goto command;
  467.             }
  468.             if (secchar == 'M') {
  469.                sscanf(argpos,"%d",&temp);
  470.                if (temp < 0 || temp > 7 || ((temp&4) && !(temp&1))) {
  471.                   fputs("Illegal graphics mode!\n",console);
  472.                   goto command;
  473.                }
  474.                color_mode = temp;
  475.                if (!(color_mode & 0x2))
  476.                   if (max_y > 200-STARTY)
  477.                      max_y = 200-STARTY;
  478.                if (!(color_mode & 0x4))
  479.                   if (max_x > 320)
  480.                      max_x = 320;
  481.                goto command;
  482.             }
  483.             if (secchar == 'D') {
  484.                sscanf(argpos,"%d",&temp);
  485.                if (temp < 1) {
  486.                   fputs("Divisor must be greater than 0!\n",console);
  487.                   goto command;
  488.                }
  489.                color_div = temp;
  490.                goto command;
  491.             }
  492.             if (secchar == 'T') {
  493.                sscanf(argpos,"%d",&temp);
  494.                if (temp < 0 || temp > 4095) {
  495.                   fputs("Color must be between 0 and 4095!\n",console);
  496.                   goto command;
  497.                }
  498.                color_inset = temp;
  499.                goto command;
  500.             }
  501.             ill_cmd();
  502.             goto command;
  503.          case 'F':
  504.             sscanf(stpblk(cmd+1),"%d",&temp);
  505.             if (temp < 0 || temp > 1) {
  506.                fputs("Function number must be 0 or 1!\n",console);
  507.                goto command;
  508.             }
  509.             func_num = temp;
  510.             goto command;
  511.          case 'P':
  512.             sscanf(stpblk(cmd+1),"%d",&temp);
  513.             SetPresets(temp);
  514.             goto command;
  515.          case 'D':
  516.             if (v_fp == NULL) {
  517.                fputs("Must <G>enerate or <L>oad first!\n",console);
  518.                goto command;
  519.             }
  520.             if (disp_mand() == NULL)
  521.                wait_close();
  522.             goto command;
  523.          case 'G':
  524.             if (gen_mand() == NULL)
  525.                wait_close();
  526.             goto command;
  527.          case 'A':
  528.             if (v_fp == NULL) {
  529.                fputs("Must <G>enerate or <L>oad first!\n",console);
  530.                goto command;
  531.             }
  532.             if (!(color_mode & 1)) {
  533.                fputs("Cannot be in hold and modify!\n",console);
  534.                goto command;
  535.             }
  536.             anal_mand();
  537.             goto command;
  538.          case ';':
  539.             goto command; /* Lattice will complain about this line! */
  540.          case '<':
  541.             if (redir_fp) {
  542.                fclose(redir_fp);
  543.                redir_fp = NULL;
  544.             }
  545.             redir_fp = fopen(stpblk(cmd+1),"r");
  546.             if (redir_fp == NULL)
  547.                fprintf(console,"Can't open file %s!\n",stpblk(cmd+1));
  548.             goto command;
  549.          case 'Q':
  550.             abort("Bye!");
  551.          case '?':
  552.          case 'H':
  553.          default:
  554.             AvailableCommands();
  555.             goto command;
  556.       }
  557.    }
  558. }
  559.  
  560. ill_cmd()
  561. {
  562.    fputs("Unknown command!\n",console);
  563. }
  564.  
  565. float cnvf(i)
  566. int i;
  567. {
  568.    union kludge n;
  569.  
  570.    n.i = i;
  571.    n.i = SPTieee(n.i);
  572.    return (n.f);
  573. }
  574.  
  575.  
  576. /*-----------------------------------------*/
  577. /* Non-intelligent virtual memory handling */
  578.  
  579. v_pos_line(l)
  580. int l;
  581. {
  582.    if (l < v_starty) {
  583.       if (modified) 
  584.          v_flush();
  585.       v_starty = 0;
  586.       fseek(v_fp,v_offset,0);
  587.       if (want_read)
  588.          fread(v_mand_store,max_x*sizeof(UWORD),max_mem,v_fp);
  589.    }
  590.    if (l-v_starty > max_mem-1) {
  591.       if (modified)
  592.          v_flush();
  593.       v_starty += max_mem;
  594.       fseek(v_fp,(long)(v_starty*max_x*sizeof(UWORD)+v_offset),0);
  595.       if (want_read)
  596.          fread(v_mand_store,max_x*sizeof(UWORD),max_mem,v_fp);
  597.    }
  598. }
  599.  
  600. v_flush()
  601. {
  602.    fseek(v_fp,(long)(v_starty*max_x*sizeof(UWORD)+v_offset),0);
  603.    fwrite(v_mand_store,max_x*sizeof(UWORD),max_mem,v_fp);
  604.    modified = FALSE;
  605. }
  606.  
  607. abort(s)
  608. char *s;
  609. {
  610.    if (cur_resource & F_MATHTRANS)
  611.       CloseLibrary(MathTransBase);
  612.    if (cur_resource & F_MATH)
  613.       CloseLibrary(MathBase);
  614.    if (cur_resource & F_CONSOLE)
  615.       fclose(console);
  616.    if (v_fp)
  617.       fclose(v_fp);
  618.    if (redir_fp)
  619.       fclose(redir_fp);
  620.    if (cur_resource & F_GRAPHICS)
  621.       CloseLibrary(GfxBase);
  622.    if (cur_resource & F_INTUITION)
  623.       CloseLibrary(IntuitionBase);
  624.    if (cur_resource & F_ICON)
  625.       CloseLibrary(IconBase);
  626.    if (cur_resource & F_SETSTORE)
  627.       free(v_mand_store);
  628.    if (cur_resource & F_COLORTAB)
  629.       free(color_table);
  630.  
  631.    CloseDisplay();
  632.  
  633.    puts(s);
  634.    exit(0);
  635. }
  636.  
  637.  
  638. SetPresets(preset)
  639. {
  640.    /* these are some common defaults, preset here to avoid repetitive
  641.     * assignments in the case statements below.  Feel free to override
  642.     * any of these defaults with your own in the case statements below
  643.     */
  644.    max_x = 320;
  645.    max_y = 200;
  646.    max_count = 29;
  647.    color_inc = 1;
  648.    color_set = 1;
  649.    color_mode = 1;
  650.    color_div = 1;
  651.    func_num = 0;
  652.  
  653.    switch (preset)
  654.       {
  655.       case 0:
  656.          fputs("Mandelbrot's Set\n", console);
  657.          start_r.f = -2.85;
  658.          end_r.f = 2.85;
  659.          start_i.f = -2.05;
  660.          end_i.f = 2.05;
  661.          max_count = 15;
  662.          color_offset = 91;
  663.          break;
  664.       case 1:
  665.          fputs("Unbounded Rhythms\n", console);
  666.          start_r.f = 1.703418;
  667.          end_r.f = 2.016930;
  668.          start_i.f = -0.169450;
  669.          end_i.f = 0.169450;
  670.          color_offset = 31;
  671.          break;
  672.       case 2:
  673.          fputs("RJ's Gangliactic\n", console);
  674.          start_r.f = 1.937821;
  675.          end_r.f = 1.945044;
  676.          start_i.f = -0.00259;
  677.          end_i.f = 0.00259;
  678.          color_offset = 31;
  679.          break;
  680.       case 3:
  681.          fputs("Mandelbrot Recursion\n", console);
  682.          start_r.f = -0.294473;
  683.          end_r.f = -0.288444;
  684.          start_i.f = 0.012677;
  685.          end_i.f = 0.014839;
  686.          color_offset = 26;
  687.          max_count = 90;
  688.          break;
  689.       case 4:
  690.          fputs("Crackle\n", console);
  691.          start_r.f = 0.225;
  692.          end_r.f = 0.275;
  693.          start_i.f = 0.8425;
  694.          end_i.f = 0.8525;
  695.          color_offset = 61;
  696.          max_count = 31;
  697.          break;
  698.       case 5:
  699.          fputs("Connections\n", console);
  700.          start_r.f = 0.115206;
  701.          end_r.f = 0.168190;
  702.          start_i.f = -1.036059;
  703.          end_i.f = -0.985386;
  704.          color_offset = 76;
  705.          color_inc = 2;
  706.          break;
  707.       default:
  708.         fputs("SORRY:  there's not that many presets!\n",console);
  709.         break;
  710.       }
  711.    
  712.    ZoomCenterX = max_x >> 1;
  713.    ZoomCenterY = max_y >> 1;
  714.    ZoomBoxSizeX = max_x;
  715.    ZoomBoxSizeY = max_y;
  716.    start_r.i = SPFieee(start_r.i);
  717.    end_r.i = SPFieee(end_r.i);
  718.    start_i.i = SPFieee(start_i.i);
  719.    end_i.i = SPFieee(end_i.i);
  720.    max_mem = max_mem_y * MAXX / max_x;
  721.    init_colors();
  722. }
  723.